<style>
    th {
        text-align: center;
    }
    .table>tbody>tr>td {
        line-height: 60px;
        text-align: center;
        height: 50px;
        margin: 0px;
    }
</style>
<!-- css -->
<link href="__PUBLIC__/ganged/Css/bootstrap.css" rel="stylesheet" type="text/css" />

<div id="data_page" class="in_page">
    <div class="panel panel-default">
        <div class="panel-body">
            <div class="btn-group" role="group" aria-label="..." style="float:right;margin-right:20px">
                <a href="{:U('add')}">
                    <button type="button" class="btn btn-primary">添加</button>
                </a>
            </div>
        </div>
    </div>
    <table class="table table-striped table-bordered table-condensed ">
        <thead>
            <tr>
                <th>Id</th>
                <th>图片</th>
                <th>姓名</th>
                <th>城市</th>
                <th>地址</th>
                <th>年龄</th>
                <th>资历</th>
                <th>排序</th>
                <th>状态</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <volist name="list" id="li">
                <tr>
                    <td>{$li.id}</td>
                    <td><img src="{$li.img}"  width="50px" height="50px"/></td>
                    <td>{$li.name}</td>
                    <td>{$li.pro}{$li.city}{$li.area}</td>
                    <td>{$li.address}</td>
                    <td>{$li.age}</td>
                    <td>{$li.seniority}</td>
                    <td>{$li.sort}</td>
                    <td><eq name="li['status']" value="1">开启<else />关闭</eq></td>
                    <td>{$li.create_time|date='Y-m-d H:i:s',###}</td>
                    <td>
                        <a href="{:U('edit',array('id'=>$li['id']))}">
                            <button type="button" class="btn btn-sm btn-success">修改</button>
                        </a>
                        <button type="button" class="btn btn-sm btn-danger del" d_id="{$li.id}">删除</button>
                    </td>
                </tr>
            </volist>
        </tbody>
    </table>
</div>
<div>{$page}</div>
<script>
    $(function () {
        //删除店铺
        $(".del").click(function (obj) {
            $_this = $(this);
            var id = $(this).attr("d_id");
            if (confirm("您确认删除吗?")) {
                $.post("{:U('del')}", { 'id': id }, function (obj) {
                    alert(obj.m);
                    if (obj.s) {
                        $_this.parent().parent().remove();
                        // if(typeof(obj.url) != undefined && obj.url){
                        //     location.href = obj.url;
                        // }
                    }
                });
            }
            return false;
        });
        $(".ajax-post").click(function (t) {
            var $this = $(t);
            var url = $this.attr('href');
            if ($this.hasClass('confirm')) {
                if (confirm($this.data('original-title'))) {

                }
            } else {
                $.post(url, {}, function (obj) {
                    if (obj.status) {
                        if (typeof (obj.url) != 'undefined' && obj.url) {
                            location.href = obj.url;
                        }
                    } else {
                        alert(obj.info);
                    }
                });
            }
            return false;
        });
    });
</script>